home *** CD-ROM | disk | FTP | other *** search
Wrap
XSetup plugin | 2002-01-01 | 7.5 KB | 282 lines
"FILE"="Xteq Systems X-Setup Plugin 6.0" "TYPE"="9" "COUNT"="1" "UIPATH 1"="Appearance\Start Menu\Windows 95" "UIPATH 2"="Appearance\Start Menu\Windows NT" "UIPATH 3"="Appearance\Start Menu\Windows 98" "UIPATH 4"="Appearance\Start Menu\Windows 2000" "UIPATH 5"="Appearance\Start Menu\Windows ME" "NAME"="Visible Items in Start->Find" "LANGUAGE"="VBScript" "VERSION"="3.00" "OSVERSION"="11111" "TEXT 1"="dⁿdel dumm" "DESCRIPTION 1"="This plug-in lets you control which options are shown on the Find menus on the Start Menu and in Windows Explorer. These icons are all part of Windows or Internet Explorer." "DESCRIPTION 2"="To show an option on the menu, enable it, otherwise disabling the option will hide it." "DESCRIPTION 3"="Please note that this list maybe shows activated entires than are not visibile in the find menu. These are entries that perform a validation if it's usefull to show them or not. For example, the "Search for Computers..." will only be visible if you are connected to a network. If you are using a stand-alone machine, it will hide itself automatically." "DESCRIPTION 4"="Important #1: If 'Files or Folders' is hidden, 'Computer' will also be hidden!" "DESCRIPTION 5"="Important #2: Disabling all items will lead to an empty menu being displayed!" "DESCRIPTION 6"="Important #3: These changes apply to ALL users on this machine!" "COMMENT 1"="Bloody complicated plug-in!!!" "COMMENT 2"="Based on plug-in by Neil R. Turner (totalxs@hotmail.com)" "COMMENT 3"="Thanks to Little Dave [sirturque@bigfoot.com] for the bug notice!" "AUTHOR"="Xteq Systems" "CONTACTURL"="http://www.xteq.com/" "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved" ' Where all of the Find keys are installed: sP1="HKLM\Software\Microsoft\Windows\CurrentVersion\explorer\FindExtensions\Static\" sP2="HKLM\Software\Microsoft\Windows\CurrentVersion\explorer\FindExtensions\Static-\" Dim iReg 'conatins how many are currently displayed in the UI Dim aryReg() 'contains all the registry keys Sub Plugin_Initialize Call ReadRegistry End Sub Sub ReadRegistry 'first, clear the UI for l=1 to iReg Call SetUIElement(l,"") next '--------------------------------------- 'read the active entries 'read top level (Path\Path) iItems=RegEnumPaths(sP1) dim aryTemp1 ReDim aryTemp1(iItems) For l=1 to iItems sItem=RegEnumElement(l) aryTemp1(l)=sP1 & sItem & "\" next 'now read the entires below dim aryTemp2 ReDim aryTemp2(100) 'should be enough... lSubItemCounter2=0 for l=1 to iItems sPath=aryTemp1(l) iSubItems=RegEnumPaths(sPath) for i=1 to iSubItems sItem=RegEnumElement(i) lSubItemCounter2=lSubItemCounter2+1 aryTemp2(lSubItemCounter2)=sPath & sItem & "\" next next '--------------------------------------- 'now read the deactivated items 'read top level (Path\Path) iItems=RegEnumPaths(sP2) dim aryTemp3 ReDim aryTemp3(iItems) For l=1 to iItems sItem=RegEnumElement(l) aryTemp3(l)=sP2 & sItem & "\" next 'now read the entires below dim aryTemp4 ReDim aryTemp4(100) 'should be enough... lSubItemCounter4=0 for l=1 to iItems sPath=aryTemp3(l) iSubItems=RegEnumPaths(sPath) for i=1 to iSubItems sItem=RegEnumElement(i) lSubItemCounter4=lSubItemCounter4+1 aryTemp4(lSubItemCounter4)=sPath & sItem & "\" next next '--------------------------------------- 'okay, we now have two arrays (aryTemp2 and aryTemp4) that contain 'all the items that we need. We now simply need to create ONE array from those two iReg=lSubItemCounter2+lSubItemCounter4 ReDim aryReg(iReg) for l=1 to lSubItemCounter2 aryReg(l)=aryTemp2(l) next for i=1 to lSubItemCounter4 aryReg(lSubItemCounter2+i)=aryTemp4(i) next '--------------------------------------- 'finally, update the UI for l=1 to UBound(aryReg) sItem=aryReg(l) sName=RegReadValue(sItem & "\@") if len(sName)=0 then sName="<UNKNOWN>" end if 'remove stupid &.. sName=replace(sName,"&","") bActivated=0 if InStr(sItem,sP2)>0 then bActivated=false else bActivated=true end if Call SetUIElement(l,sName) Call SetUIElementEx(l,bActivated) next End Sub Sub Plugin_Apply(ElementIndex,ElementSubIndex) bChanges=false for l=1 to UBound(aryReg) sItem=aryReg(l) bUI=GetUIElementEx(l) if InStr(sItem,sP2)>0 then bReg=false else bReg=true end if 'now check for differences between bReg and bUI if bUI=true and bReg=true then 'do nothing, both activated else if bUI=false and bReg=false then 'do nothing, both deactivated else if bUI=true and bReg=false then 'in UI activated, in REG Deactivated -> 'move from <Static-> to <Static> sOldPath=sItem sNewPath=Replace(sOldPath,sP2,sP1) else 'in UI deactivated, in REG activated -> 'move from <Static> to <Static-> sOldPath=sItem sNewPath=Replace(sOldPath,sP1,sP2) end if 'DebugMsg sOldPath & " ** " & sNewPath 'execute move action Call MoveFolder(sOldPath,sNewPath) 'set flag bChanges=true end if end if next if bChanges=true then Call ReadRegistry 'call the holy Windows API Call IndicateSettingChange() 'just to be sure... 'Call Logoff end if End Sub Sub MoveFolder(CurrentFolder,NewFolder) if right(CurrentFolder,1)<>"\" then CurrentFolder=CurrentFolder & "\" end if if right(NewFolder,1)<>"\" then NewFolder=NewFolder & "\" end if 'check for any existing subfolder iC=RegEnumPaths(CurrentFolder) if iC>0 then Dim aryTemp() ReDim aryTemp(iC) for i=1 to iC aryTemp(i)=RegEnumElement(i) & "\" next for i=1 to iC sP_Old=CurrentFolder & aryTemp(i) sP_New=NewFolder & aryTemp(i) Call MoveFolder(sP_Old,sP_New) next end if Call MoveValues(CurrentFolder,NewFolder) Call RegDeletePath(CurrentFolder) End Sub Sub MoveValues(OldFolder,NewFolder) 'check for "NORMAL" Values iC=RegEnumValues(OldFolder) for i=1 to iC x_Name=RegEnumElement(i) x_Type=RegValueType(OldFolder & x_Name) x_Value=RegReadValue(OldFolder & x_Name) 'move to new location Call RegWriteValue(NewFolder & x_Name,x_Value,x_Type) 'delete old value Call RegDeleteValue(OldFolder & x_Name) next 'check for @ Value x_Name="@" if len(RegReadValue(OldFolder & x_Name))>0 then x_Type=RegValueType(OldFolder & x_name) x_Value=RegReadValue(OldFolder & x_Name) 'move to new location Call RegWriteValue(NewFolder & x_Name,x_Value,x_Type) 'delete old value Call RegDeleteValue(OldFolder & x_Name) end if End Sub Sub Plugin_Terminate End Sub